1
00:00:00,850 --> 00:00:01,290
All right.

2
00:00:01,300 --> 00:00:02,430
Let's talk math.

3
00:00:02,500 --> 00:00:11,250
So the nice thing about Python is that right off the bat it has a built in math interpreter.

4
00:00:11,260 --> 00:00:19,150
So what we can use it for his addition subtraction multiplication division etc. We can we can throw

5
00:00:19,150 --> 00:00:21,690
numbers at it and it'll do calculations for us.

6
00:00:21,700 --> 00:00:24,610
So let's take a look at what that actually looks like.

7
00:00:24,610 --> 00:00:27,160
So I'm going to go ahead and get it.

8
00:00:27,220 --> 00:00:30,070
We'll call this math dot pi even call this whatever you'd like.

9
00:00:30,070 --> 00:00:39,930
By the way I'm going to put the ampersand at the end again and we'll just declare our being in Python

10
00:00:39,930 --> 00:00:43,860
three here and then let's just call this math.

11
00:00:44,520 --> 00:00:49,530
So the nice thing about math is we can do a lot of different things.

12
00:00:49,530 --> 00:00:55,840
We're very flexible so for example we can print 50 plus 50.

13
00:00:56,040 --> 00:00:58,880
And here we're just adding right.

14
00:00:58,920 --> 00:01:00,750
So let's take a look at what this looks like.

15
00:01:01,380 --> 00:01:06,850
We go here and we just say Python three math dot pi.

16
00:01:06,950 --> 00:01:09,550
You can see that it prints out 100.

17
00:01:09,590 --> 00:01:11,990
Now we can keep doing this for all sorts of different things.

18
00:01:11,990 --> 00:01:12,220
Right.

19
00:01:12,230 --> 00:01:16,640
We can do 50 minus 50 and we would expect zero here.

20
00:01:16,640 --> 00:01:17,000
Right.

21
00:01:18,050 --> 00:01:22,970
And we can do print 50 times 50

22
00:01:26,580 --> 00:01:35,340
and we can also do print fifty divided by 50 and divide.

23
00:01:35,340 --> 00:01:38,640
So I'm going to give you a chance to catch up here.

24
00:01:38,640 --> 00:01:40,260
I type that very fast.

25
00:01:40,260 --> 00:01:41,670
I also have notes that I'm looking at.

26
00:01:41,670 --> 00:01:49,260
So a little bit of unfair advantage but so when we see these and we save this and we run it we're expecting

27
00:01:49,260 --> 00:01:52,080
everything to interpret just the way it did.

28
00:01:52,080 --> 00:01:59,550
So you see one hundred zero twenty five hundred and then this one point zero which we'll get into in

29
00:01:59,610 --> 00:02:08,370
just a little bit as to why it's coming out in a one point zero format but so we have this here and

30
00:02:08,460 --> 00:02:18,750
we can also do some interesting things like let's do something fun let's do print 50 plus 50 minus 50

31
00:02:20,010 --> 00:02:24,780
times 50 and divide by 50.

32
00:02:24,780 --> 00:02:31,540
And what do you think this is going to do Ah good old friend of pen does if you remember that from math

33
00:02:31,540 --> 00:02:31,900
class.

34
00:02:31,930 --> 00:02:37,930
So try it one more time see a number of pops out pops out of 50 cell.

35
00:02:38,530 --> 00:02:42,400
It also does more complex equations as well.

36
00:02:43,330 --> 00:02:46,350
So there's a few other things that I want to show you in the math section.

37
00:02:46,540 --> 00:02:50,140
And another thing to know I know I've already stressed this before and I'm going to keep stressing it

38
00:02:50,140 --> 00:02:52,540
is to make sure you take good notes.

39
00:02:52,570 --> 00:02:54,940
This is absolutely going to feel overwhelming.

40
00:02:54,940 --> 00:02:59,440
I mean if there are a lot of things that you especially with all the stuff that you're learning take

41
00:02:59,440 --> 00:03:03,850
good notes have a good notebook and make sure you're writing this all down so then you could just go

42
00:03:03,850 --> 00:03:05,430
back and you can reference it.

43
00:03:05,440 --> 00:03:10,540
And from here on out I'm the next video what we're going to do is we're going to make a script and we're

44
00:03:10,540 --> 00:03:15,220
just going to build upon it and I'll just leave everything in that script so that we can have a place

45
00:03:15,220 --> 00:03:16,750
for all of your notes as well.

46
00:03:17,140 --> 00:03:22,530
So here let's talk a couple more things so we can also do exponent.

47
00:03:22,560 --> 00:03:28,820
So let's say we wanted to do fifty to the fiftieth power while we just write it like this.

48
00:03:29,110 --> 00:03:37,800
And now we have exponents here say that run it really quick and we get this very very very large number.

49
00:03:37,810 --> 00:03:38,840
Right.

50
00:03:38,920 --> 00:03:44,270
We could just make this to the second power and make a little bit simpler.

51
00:03:44,290 --> 00:03:46,660
We could also do this.

52
00:03:46,660 --> 00:03:53,900
So we do print and we do 50 percent 6.

53
00:03:53,920 --> 00:03:55,210
Now this is called the modulo.

54
00:03:55,240 --> 00:03:56,890
Let's take a look at what it does

55
00:03:59,740 --> 00:04:02,320
so 50 is not divisible by 6.

56
00:04:02,320 --> 00:04:02,670
Right.

57
00:04:03,570 --> 00:04:08,580
So what it does is it takes the number that is left over.

58
00:04:08,580 --> 00:04:11,730
So we do 50 divisible by six.

59
00:04:11,730 --> 00:04:12,740
OK.

60
00:04:12,780 --> 00:04:17,340
Six goes into it eight times and then it has a leftover number of two.

61
00:04:17,340 --> 00:04:17,520
Right.

62
00:04:17,520 --> 00:04:20,310
Six times eight is forty eight leftover number two.

63
00:04:20,370 --> 00:04:30,330
So that's the modulo What if we were to divide by a number here and we said 50 divided by six.

64
00:04:30,450 --> 00:04:36,960
What is that going to do to us while we print that out and you see it gives eight point three three

65
00:04:36,960 --> 00:04:38,010
three three four.

66
00:04:38,490 --> 00:04:38,940
Perfect.

67
00:04:38,940 --> 00:04:39,990
That's fine.

68
00:04:39,990 --> 00:04:43,020
What if we just want a number without any leftovers.

69
00:04:43,200 --> 00:04:47,110
Well we can do something like this and do 50.

70
00:04:47,110 --> 00:04:55,010
Divided by six and then we'll say no leftovers here OK.

71
00:04:55,050 --> 00:05:04,840
Someone give you a second to catch up will hit save on this and we're gonna go ahead and run it and

72
00:05:04,860 --> 00:05:10,260
you can see that it just gives us this gives us the eight doesn't give us that leftover of two that

73
00:05:10,260 --> 00:05:14,370
we had and put it into fraction form here or decimal form here.

74
00:05:14,370 --> 00:05:20,510
So we have different ways that we can manipulate this numbers and we could do math on the fly.

75
00:05:20,530 --> 00:05:26,610
There's also math modules which we haven't gotten to the modules yet but there are additional math items

76
00:05:26,610 --> 00:05:31,080
that we can pull into this like bringing in random numbers for example and other things that we can

77
00:05:31,080 --> 00:05:39,270
do more advanced calculations in Python but as a base it does quite a bit of items for us and it is

78
00:05:39,270 --> 00:05:45,860
a essentially a built in calculator so we can do quick math on the fly if we need to.

79
00:05:45,870 --> 00:05:47,940
So let's go ahead and from here.

80
00:05:47,940 --> 00:05:52,710
We're going to move on to the next video where we start talking about variables and methods.
